<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改项目</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="{{asset('layui/css/layui.css')}}" media="all">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <script type="text/javascript" src="{{asset('Jquery/jquery-3.3.1.js')}}"></script>
</head>
<body>
<script src="{{asset('layui/layui.js')}}"></script>
<form  class="layui-form" action="{{url('updateProject')}}" method="post">
    @csrf
    <input type="hidden" name="project_id" value="{{$editProject->id}}">
    <table class="layui-table">
        <thead>
        <tr>
            <th colspan="4" style="font-size: 18px;text-align: center;color:#666666">修改项目</th>
        </tr>
        {{--<tr>
            <th style="text-align: center;color:#666666;font-size: 14px;width: 150px">
                <label >所属项目:</label>
            </th>

            <th style="width: 400px" colspan="3">
                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <select name="project_id" lay-filter="aihao" >
                            <option value="">请选择所属项目名称</option>
                            @foreach($allProject as $k=>$project)
                                <option value="{{$project->id}}" @if($project->id==old('project_id')) selected @endif>{{$project->name}}</option>
                            @endforeach
                        </select>
                    </div>
                </div>
                </div>

                @if($errors->has('project_id'))
                    <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('project_id')}}</sapn></span>
                @endif

            </th>
        </tr>--}}
        {{--<tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>项目编号:</label></th>
            <th colspan="3">
                <div>
                    <input type="text" name="project_number" required  value="{{$editProject->project_number}}" lay-verify="required" placeholder="请输入项目编号，如：No.20181208001" autocomplete="off" class="layui-input" style="width:400px; height:30px;">
                </div>
                <div>
                    @if($errors->has('project_number'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('project_number')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>--}}
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>项目名称:</label></th>
            <th colspan="3">
                <div>
                    <input type="text" name="name" required  value="{{$editProject->name}}" lay-verify="required" placeholder="请输入项目名称，如：中法新城仙居小区一期工程" autocomplete="off" class="layui-input" style="width:400px; height:30px;">
                </div>
                <div>
                    @if($errors->has('name'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('name')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px">
                <label>征收范围:</label>
            </th>
            <th colspan="3">
                <div>
                    <input type="text" name="levy_scope" required  lay-verify="required" value="{{$editProject->levy_scope}}" placeholder="请输入征地范围，如：黄湖村，王家村，十里堡村" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('levy_scope'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('levy_scope')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
       {{-- <tr>
            <div >
                <th style="text-align: center;color:#666666;font-size: 14px">
                    <label >征地面积（㎡）:</label>
                </th>
                <th style="text-align: center">
                    <div>
                        <input type="text" name="levy_area" required  value="{{$editProject->levy_area}}" lay-verify="required" placeholder="请输入征地面积，如：53897.6㎡，直接填写53897.6" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                    </div>
                    <div>
                        @if($errors->has('levy_area'))
                            <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('levy_area')}}</sapn></span>
                        @endif
                    </div>
                </th>
            </div>
        </tr>--}}
       {{-- <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label >项目起止时间：</label></th>
            <th>
                <div class="layui-inline">
                    --}}{{-- <label class="layui-form-label">请选择日期</label>--}}{{--
                    <div class="layui-input-inline">
                        <input type="text" name="start_end_time" class="layui-input" required id="test6" placeholder=" - " value="{{$editProject->start_end_time}}">
                    </div>
                </div>
            </th>
        </tr>--}}

        <tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>拆迁公司：</label></th>
            <th>
                <div>
                    <input type="text" name="actuator" required  value="{{$editProject->actuator}}" lay-verify="required" placeholder="请输入拆迁公司/执行机构，多个用“，”隔开，如：绿地集团，万科集团" autocomplete="off" class="layui-input" style="width:450px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('actuator'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('actuator')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>
        {{--<tr>
            <th style="text-align: center;color:#666666;font-size: 14px"><label>项目负责人：</label></th>
            <th>
                <div>
                    <input type="text" name="project_leader" required  value="{{$editProject->project_leader}}" lay-verify="required" placeholder="请输入项目负责人，多个用“，”隔开，如：王五，赵六" autocomplete="off" class="layui-input" style="width:400px; height:30px;" >
                </div>
                <div>
                    @if($errors->has('project_leader'))
                        <span class="s3"><i class="red">*</i>  <sapn id="cellphone_point" style="color: red">{{$errors->first('project_leader')}}</sapn></span>
                    @endif
                </div>
            </th>
        </tr>--}}
        <tr>
            <th colspan="4" style="color:deeppink;font-size: 25px;text-align: center">
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="">确认修改</button>
                    </div>
                </div>
            </th>
        </tr>
        </div>
        </thead>
    </table>
    <div class="layui-form-item"><input type="hidden" id="promptMessage" name="promptMessage" value="{{Session::get('status')}}"></div>
</form>
</div>
{{--添加成功后的提示信息--}}
<script>
    layui.use(['layer'],function(){
        var layer=layui.layer;
        var msg=$("#promptMessage").val();
        if(msg!=""){
            layer.msg(msg);
        }
    });
</script>
{{--监听--}}
<script>
    $(function () {
        layui.use('form', function () {
            var $ = layui.jquery;
            var form = layui.form; //Tab的切换功能，切换事件监听等，需要依赖element模块
            form.on('select()', function(data){
                $("#videoNum").empty();
                var videoId=$("#changeVideo option:selected").val()
                var url="{{url('getVideoNum')}}";
                $.ajax({
                    url:url,
                    type:'POST',
                    data:{'videoId':videoId,'_token':"{{csrf_token()}}"},
                    success:function(response){
                        $("#videoNum").empty();
                        $("#videoNum").append(response);


                    }

                });
            });

        });

    });

</script>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //日期范围
        laydate.render({
            elem: '#test6'
            ,range: true
        });
    })
</script>
{{--视频上传--}}
<script>

    layui.use('upload', function(){
        var upload = layui.upload;
        /*视频上传*/
        $(function () {
            var uploadInst = upload.render({
                elem: '#videos' //绑定元素
                ,field:'vid'
                ,accept:'video'
                ,acceptMime:'video/mkv'
                ,exts:'mkv|avi|wmv|mp4|rmvb|3gp|mov|avm|flv|m4v'
                ,size:1024*1024*10
                ,url: '/api/uploadVideo' //上传接口
                ,before: function(obj){
                    layer.load();
                }
                ,done: function(res){
                    layer.closeAll('loading'); //关闭loading
                    if(res.msg==1){
                        layer.msg('小主，影片上传成功哦！', {icon: 6});
                        $("#vid_url").val(res.url);
                        $('#tipMsg').text('(成功)');
                    }
                    //上传完毕回调
                }
                ,error: function(error){
                    layer.closeAll('loading'); //关闭loading
                    //请求异常回调
                    if(error.msg==0){
                        layer.msg('小主，影片上传失败啦！', {icon: 2});
                        $('#tipMsg').text('(失败)');
                    }
                }
            });
        });
    });

</script>
</body>
</html>